<%-- 
    Document   : produto
    Created on : 14/05/2010, 19:48:42
    Author     : 710930
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <script src="../js/script.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>

    <jsp:useBean id="categoriaBean" beanName="lojavirtual.bean.CategoriaBean"
                 type="lojavirtual.bean.CategoriaBean"/>

    <body>
        <h1>Cadastro de Categoria</h1>

        <form action="/LojaVirtual/validarusuarioservlet" method="post">

            <div style="color: red;">${errorMessage} <br/> </div>

            Nome <br/>
            <input type="text" name="nome"/> <br/> <br/>

            Descrição <br/>
            <textarea name="descricao" rows="5" cols="35"></textarea> <br/> <br/> <br/>

            Peso <br/>
            <input type="text" name="peso"/> <br/> <br/>

            Preco <br/>
            <input type="text" name="preco"/> <br/> <br/>

            <div>
                Categorias <br/>
                <select multiple="true" name="categoriasOpcoes" id="opcoes" style="width: 200px;">
                    <c:forEach items="${categoriaBean.categorias}" var="categoria">
                        <option value="${categoria.id}"> <c:out value="${categoria.nome}"/>  </option>
                    </c:forEach>
                </select>

                <span>
                    <input type="button" value=">>" 
                           onclick="moverCategoria($('opcoes'),$('categorias'))"/>
                    <input type="button" value="<<"
                           onclick="moverCategoria($('categorias'),$('opcoes'))"/>
                </span>

                <select multiple="true" name="categorias" id="categorias" style="width: 200px;">
                </select>
                
            </div>

            <br/>

            <input type="submit" onclick="prepareEnvio($('categorias'))"/>
        </form>
    </body>
</html>
